<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/hdocs/style/css/question.css" type="text/css" rel="stylesheet" />
<link href="/hdocs/style/css/common.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/hdocs/jquery/js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="/hdocs/style/js/common.js"></script>
<script type="text/javascript" src="/hdocs/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="/hdocs/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript">
var editor;
KindEditor.ready(function(K) {
	editor = K.create('textarea[name="complement"]', {
		resizeType : 1,
		allowPreviewEmoticons : false,
		allowImageUpload : true,
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'link']
	});
});
</script>
<title>问答-提问页</title>
</head>
<body>
      #set ($menuIndex="faq") #parse("/inc/header.html")
      <div class="qusTop">
            <div class="qfeiYe">
                  <a href="/faq/questions.html">问答</a> <span> &gt; 提新问题</span>
            </div>
      </div>
      <p class="h10"></p>
      <p class="h10"></p>
      <div class="centent">
      		<form id="mainFrom" action="/faq/addQuestion.jsp" method="post">
            <div class="cenLe">
                  <div class="fbTita">
                        <span class="fbSpan">问题：</span>
                        <input id="question" name="question" type="text" class="fbInp"/>
                  </div>
                  <p class="h10"></p>
                  <p class="h10"></p>
                  <div class="fbTitc">
                        <span class="fbSpan">补充：</span>
                        <textarea id="complement" name="complement" class="fbText"></textarea>
                  </div>
                  <p class="h10"></p>
                  <p class="h10"></p>
                  <div class="chgIncm">
				 	  <span>标签：</span>
				 	  <input id="label" name="label" type="text" value="$!label" readonly class="fbInp"/>
				  </div>
				  <p class="h10"></p>
                  #parse("/inc/label.html")
                  <p class="h10"></p>
                  <p class="h10"></p>
                  <p class="fbSbtn">
                        <input type="hidden" id="status" name="status" value="0"/>
                        <a href="javascript:addQuestion(1);" class="fbsta"></a>
                        <a href="javascript:addQuestion(0);" class="fbstb"></a>
                  </p>
            </div>
            </form>
            <div class="cenRi">
                  <p class="fbFp">草稿箱（<a href="#">$!draftList.size()</a>）</p>
                  #foreach( $draft in $draftList)
                  <p class="fbRtcv">
                        <a href="/faq/updateQuestionInit.jsp?id=$!draft.id" class="fbRta">$!draft.question</a>
                        <span class="fbRtb">$!draft.modifydate</span>
                  </p>
                  #end
            </div>
      </div>
      #parse("/inc/footer.html")
</body>
</html>
<script type="text/javascript">
function addQuestion(status) {
	if(!confirm("您确认保存问题吗?")){
		 return;
	}
	if(!validate()){
		return;
	}
	$("#status").val(status);
	$("#mainFrom").submit();
}

function validate(){
	var question = $("#question").val();
	if(question==null||question==''){
		alert("问题不能为空！");
		return false;
	}
	if(editor.isEmpty()){
		alert("问题内容不能为空！");
		return false;
	}
	$("#complement").val(editor.html());
	var label = $("#label").val();
	if(label==null||label==''){
		alert("问题标签不能为空！");
		return false;
	}
	return true;
}
</script>

